-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ACS-6668] [ACS-6669] e2e migration - Info Drawer general and library properties tests #3628
Conversation
a35800a
to
dac5bff
Compare
b9d3488
to
592ca07
Compare
e2e/playwright/info-drawer/src/tests/library-properties.spec.ts
Outdated
Show resolved
Hide resolved
e2e/playwright/info-drawer/src/tests/library-properties.spec.ts
Outdated
Show resolved
Hide resolved
e2e/playwright/info-drawer/src/tests/library-properties.spec.ts
Outdated
Show resolved
Hide resolved
import { ApiClientFactory, Utils, test, SitesApi, QueriesApi, SITE_VISIBILITY, SITE_ROLES } from '@alfresco/playwright-shared'; | ||
|
||
test.describe('Library properties', () => { | ||
let sitesApi: SitesApi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sitesApi, username, user2, user3 and site are duplicated in describe for "non manager" - can we reuse instead of duplicating?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved it accordingly, user2 and user3 were not needed on the top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please let me know if I need to fix the sitesApi too (because I'm not sure how)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@katarzynakita I was thinking about something more or less like that structure. Thanks that all these variables like sitesApi, username, user2, user3, site etc. are not duplicated and beforeEach have less duplicated code too. You can also check if rest of code like afterEach etc. won't be possible too to write like that.
But basically in that solution you have one main describe with whole common code and two different describes for each part of e2es like "non manager" and "manager" describes.
test.describe('Library properties', () => {
let sitesApi: SitesApi;
let apiClientFactory: ApiClientFactory;
const username = `user1-${Utils.random()}`;
const site = {
name: `site1-${Utils.random()}`,
id: `site-id-${Utils.random()}`,
visibility: SITE_VISIBILITY.MODERATED,
description: 'my site description'
};
test.beforeAll(async () => {
apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
sitesApi = await SitesApi.initialize(username, username);
await sitesApi.createSite(site.name, site.visibility, site.description, site.id);
});
test.describe('Manager', () => {
const siteForUpdate = {
name: `site2-${Utils.random()}`,
id: `site-id-${Utils.random()}`,
visibility: SITE_VISIBILITY.MODERATED,
description: 'my initial description'
};
const siteDup = `site3-${Utils.random()}`;
test.beforeAll(async () => {
try {
await sitesApi.createSite(siteForUpdate.name, siteForUpdate.visibility, siteForUpdate.description, siteForUpdate.id);
await sitesApi.createSite(siteDup);
} catch (error) {
console.error(`beforeAll failed: ${error}`);
}
});
});
test.describe('Non manager', () => {
const user2 = `user2-${Utils.random()}`;
const user3 = `user3-${Utils.random()}`;
test.beforeAll(async () => {
try {
await apiClientFactory.createUser({ username: user2 });
await apiClientFactory.createUser({ username: user3 });
await sitesApi.addSiteMember(site.id, user2, SITE_ROLES.SITE_COLLABORATOR.ROLE);
await sitesApi.addSiteMember(site.id, user3, SITE_ROLES.SITE_MANAGER.ROLE);
} catch (error) {
console.error(`beforeAll failed: ${error}`);
}
});
});
});
e2e/playwright/info-drawer/src/tests/library-properties.spec.ts
Outdated
Show resolved
Hide resolved
e2e/playwright/info-drawer/src/tests/library-properties.spec.ts
Outdated
Show resolved
Hide resolved
projects/aca-playwright-shared/src/page-objects/components/adf-info-drawer.component.ts
Outdated
Show resolved
Hide resolved
projects/aca-playwright-shared/src/page-objects/pages/favorites.page.ts
Outdated
Show resolved
Hide resolved
e2e/playwright/info-drawer/src/tests/library-properties.spec.ts
Outdated
Show resolved
Hide resolved
da7cad5
to
18f572c
Compare
Quality Gate passedIssues Measures |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x")
What is the new behaviour?
Migrated e2e infoDrawer - files: general and library properties tests from Protractor to Playwright
Does this PR introduce a breaking change? (check one with "x")